//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "DebugWinU.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TDebugWin *DebugWin;
//---------------------------------------------------------------------------
__fastcall TDebugWin::TDebugWin(TComponent* Owner, DebugStateFP SetDS)
        : TForm(Owner)
{
  ChangeDS = SetDS;
}
//---------------------------------------------------------------------------

void __fastcall TDebugWin::FormCreate(TObject *Sender)
{
NextRow = 0;
StrGridDebug->ColWidths[0] = 125;
StrGridDebug->ColWidths[1] = 800;
}
//---------------------------------------------------------------------------


void __fastcall TDebugWin::Log(String Message)
{
StrGridDebug->Cells[0][NextRow] = CIISDateTimeToStr( Now() );
StrGridDebug->Cells[1][NextRow] = Message;
NextRow++;
if( NextRow >= StrGridDebug->RowCount ) NextRow = 0;
StrGridDebug->Cells[0][NextRow] = "";
StrGridDebug->Cells[1][NextRow] = "-->";
}

void __fastcall TDebugWin::BitBtnClearClick(TObject *Sender)
{
for( int i = 0; i < StrGridDebug->RowCount; i++)
{
  StrGridDebug->Cells[0][i] = "";
  StrGridDebug->Cells[1][i] = "";
  NextRow = 0;
  StrGridDebug->Cells[0][NextRow] = CIISDateTimeToStr( Now() );
  StrGridDebug->Cells[1][NextRow] = "Log cleard";
}
}
//---------------------------------------------------------------------------


void __fastcall TDebugWin::FormClose(TObject *Sender, TCloseAction &Action)
{
  ChangeDS(0);
}
//---------------------------------------------------------------------------

